package com.example.demo.modules.controller;


import com.example.demo.modules.entity.DeviceInfo;
import com.example.demo.modules.service.IDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhengyingya
 * @since 2023-04-12
 */
@RestController
@RequestMapping("/deviceInfo")
public class DeviceInfoController {
    @Autowired
    IDeviceInfoService deviceInfoService;

    @GetMapping("/list")
    List<DeviceInfo> list() {
        return deviceInfoService.list();
    }

    @PostMapping("/add")
    Boolean add(@RequestBody DeviceInfo deviceInfo) {
        return deviceInfoService.save(deviceInfo);
    }

    @PostMapping("/delete")
    Boolean delete(@RequestBody DeviceInfo deviceInfo) {
        return  deviceInfoService.removeById(deviceInfo.getId());
    }
}

